package com.mu.securitysso.dao;

import com.mu.securitysso.entity.Permission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author sht
 */
@Mapper
public interface PermissionDao {


    @Select(value=" SELECT * FROM s_permission sp " +
            " LEFT JOIN s_role_permission srp ON sp.id = srp.fk_permission_id " +
            " LEFT JOIN s_role sr ON srp.fk_role_id = sr.id " +
            " LEFT JOIN s_user_role sur ON sr.id = sur.fk_role_id " +
            " LEFT JOIN s_user su ON sur.fk_user_id = su.id " +
            " WHERE su.id = #{UserId} ")
    List<Permission> findPermissionListByUserId(int UserId);


    @Select(value=" SELECT * FROM s_permission sp WHERE sp.url = #{UserId} ")
    List<Permission> findPermissionListByPermissionUrl(String PermissionUrl);

}
